#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <Dynamics/Integrator/integrator.h>
#include <string>
using namespace PhysLeo;
namespace py = pybind11;

template<typename T>
static void declareIntegrator(py::module &mod, const std::string &typestr)
{
    using class_type = Integrator<T>;
    auto pyclass_name = std::string("Integrator") + typestr;
    py::class_<class_type, std::shared_ptr<class_type>>cls(mod, pyclass_name.c_str());

    cls.def("allocateResource", &class_type::allocateResource);
    cls.def("advanceTime", &class_type::advanceTime);
    cls.def_readwrite("internal_force_", &class_type::internal_force_);
    cls.def_readwrite("fixed_freedom_", &class_type::fixed_freedom_);
    cls.def_readwrite("gravity_", &class_type::gravity_);
    cls.def_readwrite("velocity_damping_", &class_type::velocity_damping_);
}

void initIntegrator(py::module &m)
{
    declareIntegrator<float>(m, std::string("F"));
    declareIntegrator<double>(m, std::string("D"));
}
